<!DOCTYPE html>
<title>Test that video is not reloaded on showing a dialog.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
// Make sure we don't reload a "video" element after a dialog is shown.
// Test this by loading a movie slowly and showing a dialog when a
// "loadstart" event handler is called. If the movie is reloaded when
// the dialog is "dismissed", another "loadstart" event will be fired.
async_test(function(t) {
    var movie = "../resources/test.ogv";
    var video = document.querySelector("video");

    video.onloadstart = t.step_func(function() {
        video.onloadstart = t.unreached_func();

        // Showing confirm dialog.
        confirm("I hope the movie continues to play!");
    });

    video.oncanplaythrough = t.step_func_done();

    video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=100";
});
</script>